A phenomenon called a red-eye is conventionally known in which an eye region of a human image obtained by using an electronic flash becomes red. This phenomenon occurs when a flash light is reflected by the retina of an eye, and the image of the reflected light is formed again. As a result, the eye region is sensed in red, i.e., the color of blood vessels in the retina.
Several techniques have been disclosed in relation to detection or correction of a red-eye region. As the number of pixels of a digital camera increases, and high-resolution printers are being developed now, correction of a poor hue quality region such as a red-eye region must also be executed accurately.
In some techniques of detecting or correcting a red-eye region, the size of a red-eye is predicted on the basis of image sensing conditions, and a red-eye region is determined on the basis of the predicted size and color information (e.g., Japanese Patent Laid-Open No. 5-224271). In other techniques, a red-eye region is recognized by using color information and a degree of circular shape (e.g., Japanese Patent Laid-Open No. 6-350914). Alternatively, low saturation or low illuminance regions, flesh color regions, and red regions are obtained from an image, and a red region located in a low saturation or low illuminance region in a flesh color region is recognized as a red-eye region (e.g., Japanese Patent No. 3036285).
In the above-described techniques, a red region is obtained from an image first. Then, a red-eye region is detected by using the size or shape of the red region. However, it is difficult to detect a region, where a red-eye is generated, from an entire image by using color information. The red color intensity of a red-eye changes between individuals and also depending on illumination conditions. For this reason, it is hard to set a threshold value which allows to detect all red-eye regions. For example, when the threshold value is high, red-eye region detection fails at a high probability. When the threshold value is low, a reddish skin or an object under incandescent light may also be detected. In these situations, it is not practical to accurately detect the degree of circular shape or size. In addition, it is difficult to detect a flesh color for practical use, as is well known.
Furthermore, red color component value distribution in a red-eye region is not always uniform. The red color component in a red-eye region often changes. For this reason, when a red-eye region is detected on the basis of a simple threshold value, only part of a red-eye region may be detected. When only the detected region is corrected, the corrected image may look strange.
In a technique to prevent this, a user designates the approximate position of one red-eye region, and if the other red-eye region is present, executes region extension from the reddest pixel to peripheral region, thereby detecting the red-eye region. Alternatively, a plurality of red regions are obtained, and a region, looked like red-eye most, is detected on the basis of the position, shape, and color information of the regions (e.g., Japanese Patent No. 2907120).
There is also a red-eye detection/correction technique which requires no involvement by a user (e.g., Japanese Patent Laid-Open No. 2002-305667). In this technique, face detection or eye detection is done first to identify regions which can contain a poor hue quality at a high probability. Next, the red color component is enhanced to identify the outlines and central points of obtained poor hue quality region candidates. Whether the hue of each poor hue quality region has a poor quality, i.e., whether the region is a red-eye region is determined. If the region is determined as a red-eye region, a correction mask to correct the poor hue quality is created. In addition, a red-eye defective region is obtained by using a fuzzy function. By examining neighboring pixels around the maximum value of the red-eye detect, the correction mask is extended circularly without crossing over the outline.
In the above-described red-eye region extension, it is important to determine to which extent the region should be extended, i.e., the end of region extension. In Japanese Patent No. 2907120, region extension is executed circularly, or an iris edge is detected, and extension is done up to the region inside the edge. In Japanese Patent Laid-Open No. 2002-305667, the size and the degree of eccentricity of the region and the outline data of each poor hue quality region candidate are used.
However, there is a difference in shape of eye region between individuals. Not all people have the circular iris region visibly, and some are slit-eyed persons. Hence, the region cannot simply be extended circularly. To determine the end of region extension, the size or the degree of circular shape of the detected region is used. For a slit-eyed person, the shape of the iris in the image is close to oblong rather than circular. Additionally, in some cases, a small bright region called “catch light” where the light source is reflected is present in the iris region. Since region extension based on the red color component distribution is done except the catch light region, the extended region is not circular. For this reason, the region extension end determination may fail.
That is, in Japanese Patent No. 2907120, region extension is ended when the degree of circular shape is lower than a given threshold value. In the above-described case, region extension may be ended even when a poor hue quality region still remains. As described above, even when region extension is executed, the poor hue quality region cannot accurately be detected unless the end of region extension is accurately determined.
To correct the detected poor hue quality region, generally, the luminance value of each pixel in the region detected as the poor hue quality region is decreased. Alternatively, the R value of each pixel in the region is set to a lower one of the B and G values. For example, Japanese Patent Laid-Open No. 5-224271 describes a technique of turning the color to black by reducing the luminance. Japanese Patent Laid-Open No. 2002-305667, after holes or noise of an obtained correction mask is removed, the defective region is corrected on the basis of Rnew=R−m(R−min(G,B)) where m is the red-eye defect probability corresponding to the grayscale value of the correction mask. In another correction processing, a red-eye region is replaced with the data of a non-red-eye region held in advance.
However, the iris color changes between individuals, and the brightness of iris also changes depending on illumination conditions. For these reasons, an unnatural image may be obtained when the luminance is simply reduced, or the red-eye region is replaced with an eye region sensed under different conditions. That is, it is demanded to correct the color to the iris color under normal sensing conditions.
If the poor hue quality region is not accurately detected, the corrected image looks unnatural because it contains both corrected pixels and uncorrected pixels with poor hue quality after correcting the detected region. That is, an unnatural image is obtained which contains a corrected region with normal hue and a poor hue quality region such as a red-eye region. Since the resolution of a current digital camera or printer is high, as described above, an image containing an incompletely corrected region becomes unnatural. Accordingly, the entire poor hue quality region must be detected and corrected accurately.
It is an object of the present invention to easily and accurately detect a poor hue quality region in an image and naturally correct it.